package cn.fay.chapter15;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ArrayMaker<T> {
	private Class<T> kind;
	public ArrayMaker(Class<T> kind) {
		this.kind=kind;
	}
	public T[] create(int size) {
		return (T[]) Array.newInstance(kind, size);
	}
	public List<T> c2() {
		return new ArrayList<T>();
	}
	public static void main(String[] args) {
		ArrayMaker<String> stringMaker=new ArrayMaker<String>(String.class);
		String[] ss = stringMaker.create(8);
		Integer[] newInstance = (Integer[]) Array.newInstance(Integer.class, 8);
		System.out.println(Arrays.toString(ss));
		System.out.println(Arrays.toString(newInstance));
	}
}
